<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>图书列表</title>
		<script type="text/javascript">
			var methodForm;
			var bookIdForm;
			
			function preAdd(methodForm,bookIdForm){
				var pathform = document.getElementById("pathform");
				var method=document.getElementById("method");
				method.setAttribute("value",methodForm);
				var bookId=document.getElementById("bookId");
				bookId.setAttribute("value",bookIdForm);
				pathform.submit();
			}
			<c:if test="${not empty msg}">
				var i = 3;
				function hiddenMsg() {
					if (i == 0) {
						var msgObj = document.getElementById("msg");
						msgObj.style.display = "none";
						return;
					} else {
						i--;
						setTimeout("hiddenMsg()", 1000);
					}
				}
				window.onload = hiddenMsg;
			</c:if> 
		</script>
		<style type="text/css">
			body {
				font-family: 华文楷体;
				color: #ffffff;
				font-size: 16px;
				background-color: #556b2f;
			line-height:20px
			}
			a:active {
				color: #ffffff;
				text-decoration: none;
			}
			
			a:visited {
				color: #96CFFC;
				text-decoration: none;
			}
			
			a:hover {
				color: yellow;
				text-decoration: underline;
			}
	</style>
	</head>
	<body topmargin="40px">
		<form id="pathform" action="${CONTEXT_ROOT}/SysBookServlet" method="post">
			<input id="method" name="method" type="hidden" value="preadd"></input>
			<input id="parentCategoryId" name="parentCategoryId" type="hidden" value="${parentCategoryId}"></input>
			<input id="categoryId" name="categoryId" type="hidden" value="${parentCategoryId}"></input>
			<input id="bookId" name="bookId" type="hidden" value=""></input>
			<input id="path" name="path" type="hidden" value="${path}"></input>
			</form>
		<center>
			<table width="700" border="0">
				<tr>
					<td width="25%" align="right">
						分类
					</td>
					<td width="3%" rowspan="2">
						&nbsp;
					</td>
					<td width="72%" align="left">
					<table width="100%" border="0">
					<tr>
						<td align="left">
							<!--是否出新增按钮.判断该分类中有没有子分类-->
							<c:if test="${ empty bookCategoryList }">					
								<a href="#" onclick="preAdd('preadd','');">新增</a>
							</c:if>
						</td>
						<td align="right">
							<!--右上角提示消息-->
							<span id="msg">					
								<font color="yellow">${msg}<c:remove var="msg" scope="session"></c:remove></font>
							</span>
						</td>
					</tr>
					</table>
					
					</td>
				</tr>
				<tr>
					<td align="right" valign="top">
						<table width="100%">
							<c:forEach items="${bookCategoryList}" var="bookCategory">
								<tr>
									<td align="right">
										<a
											href="${CONTEXT_ROOT}/SysBookServlet?method=list&parentCategoryId=${bookCategory.categoryId}">${bookCategory.categoryName}
										</a>
									</td>
								</tr>
							</c:forEach>
						</table>
					</td>
					<td valign="top">
						<table width="100%" border="0">
							<tr>
								<td align="left">
									<c:if test="${not empty path }">
										<a href="${CONTEXT_ROOT }/SysBookServlet?method=list">图书分类</a>- ${path}
									</c:if>
								</td>
								</tr>
						</table>
						<table width="100%" border="1">
							<tr>
								<td width="20%" height="30px">
									编号
								</td>
								<td width="55%" height="30px">
									图书名称
								</td>

								<td width="25%" height="30px">
									操作
								</td>
							</tr>
							<c:forEach items="${pageList.objectList }" var="book">
							<tr>
								<td>
									${book.bookId }
								</td>
								<td align="left">
									&nbsp;&nbsp;&nbsp;&nbsp;<a href="javascript:void(0)" onclick="preAdd('view','${book.bookId}');">${book.bookName }</a>
								</td>

								<td>
									<a href="#" onclick="preAdd('edit','${book.bookId}');">修改 </a>
									<a href="#" onclick="preAdd('del','${book.bookId}');">删除</a>
								</td>
							</tr>
							</c:forEach>
							<tr>
								<td colspan="3">
									<p>
										${pageList.pageStr}
									</p>
								</td>
							</tr>
						</table>
					</td>
				</tr>
			</table>
		</center>
	</body>
</html>